import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
import msbd from './msbd'

let state = {
    name:'zhangsan',
    age:15,
}

let mutations = {
    GET_NUM(state,data){
        console.log(state)
        state.age++
    }
}

let actions = {
    getRendlist(context,data){
        // console.log(context)
        // console.log(data)
        // context.commit("GET_NUM",data)
        context.dispatch("gettext")
    },
    gettext({dispatch,commit}){
        commit('GET_NUM')
        // console.log("触发")
    }
}

let getters = {
    mit(state,getter){
        return state.age
        console.log(state)
        console.log(getter)
    },
    list(state,getter){
        console.log(state)
        console.log(getter)
    }
}

let modules = {
    msbd,
}

let store = new Vuex.Store({
    state,
    mutations,
    actions,
    getters,
    modules
})

export default store